<?php

namespace app\controller;

use think\facade\Db;

class c
{
    public function index(){

        set_time_limit(0);
        $list = Db::name('traceability')
            ->where('wdm','=','')//146143
            ->field('id,wdm')->select()->toArray();

        foreach ( $list as $k=>$v){
            $list[$k]['wdm'] = code_str_pad(8,$v['id']);
            Db::name('traceability')->where('id',$v['id'])->update(['wdm'=>code_str_pad(8,$v['id'])]);
        }

    }

}